package we.core.handlers;

import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONObject;
import we.core.bean.CDataContainer;
import we.extension.CSystemEvent;
import we.extension.IExtension;


public abstract class CAbstractCoreHandler {
    public abstract int handleEvent(SocketChannel channel, JSONObject data);

    protected static void dispatchSystemEvent(CSystemEvent se) {        
        Map<String, IExtension> extensions = CDataContainer.instance().getExtensions();
        Iterator<Map.Entry<String, IExtension>> it = extensions.entrySet().iterator();
        while (it.hasNext()) {
            IExtension ex = it.next().getValue();
            ex.handleSystemEvent(se);
        }
    }
}
